package com.gilight.base.util;

import org.apache.commons.lang3.StringUtils;

public class StringTool {
    /**
     * 处理用于模糊查询的字符串
     *
     * StringTool.wrapWithPercentChar("用户")
     * %用户%
     * StringTool.wrapWithPercentChar("")
     * null
     * @param s
     * @return null或被%包含的字符串
     */
    public static String wrapWithPercentChar(String s) {
        char c = '%';
        if (StringUtils.isNotEmpty(s)) {
            return StringUtils.wrap(s, c);
        }
        return null;
    }

    public static void main(String[] s) {
        System.out.println(wrapWithPercentChar("2017"));
    }
}
